home *** CD-ROM | disk | FTP | other *** search
- on prepWdFind
- global gFindTitle, gFindInstr, gLangDirect, gLangSelect
- sound stop 1
- go("find")
- doMusicBtn()
- set the editable of member "wordFind" to 1
- if gLangDirect = 1 then
- set the memberNum of sprite gFindTitle to the number of member "e findTitle"
- set the memberNum of sprite gFindInstr to the number of member "e findInstr"
- else
- set the memberNum of sprite gFindTitle to the number of member (gLangSelect & " findTitle")
- set the memberNum of sprite gFindInstr to the number of member (gLangSelect & " findInstr")
- end if
- end
-
- on findWord
- global gLangDirect, gLangName, gFindMouth, gLangSelect
- cursor(4)
- put EMPTY into field "possWords"
- put EMPTY into field "wordFound"
- set the editable of member "wordFind" to 0
- set findText to field "wordFind"
- if findText <> EMPTY then
- set gDB to new(xtra("v12dbe"), the moviePath & "lang.v12", "readOnly", EMPTY)
- set gDBTable to new(xtra("v12table"), mGetRef(gDB), "language")
- if gLangDirect = 1 then
- set searchField to "myEnglish"
- else
- set searchField to "my" & gLangName
- end if
- mSetCriteria(gDBTable, searchField, "wordStarts", findText)
- mSetCriteria(gDBTable, "or", searchField, "starts", findText)
- mOrderBy(gDBTable, searchField, "ascending")
- mSelect(gDBTable)
- set selSize to mSelectCount(gDBTable)
- if selSize = 0 then
- if gLangDirect = 1 then
- put "Sorry, no results found" into field "possWords"
- else
- case gLangSelect of
- "g":
- put "Es konnten leider keine Ergebnisse gefunden werden." into field "possWords"
- "f":
- put "Désolé, aucun résultat." into field "possWords"
- "s":
- put "Lo siento, no hay resultados grabados." into field "possWords"
- "i":
- put "Mi dispiace, non si trova nessun risultato." into field "possWords"
- end case
- end if
- set the memberNum of sprite gFindMouth to the number of member "findSnd gray"
- else
- repeat with X = 1 to selSize
- put mGetField(gDBTable, searchField) & RETURN after field "possWords"
- mGoNext(gDBTable)
- end repeat
- end if
- set gDBTable to 0
- set gDB to 0
- if selSize <> 0 then
- set the scrollTop of member "possWords" to 1
- hilite line 1 of field "possWords"
- translateWord(line 1 of field "possWords")
- end if
- else
- set the memberNum of sprite gFindMouth to the number of member "findSnd gray"
- end if
- set the editable of member "wordFind" to 1
- cursor(-1)
- end
-
- on translateWord whichWord
- global gLangName, gLangDirect, gFindSnd, gLangSelect, gSndPath, gFileDelimiter, gCat, gFindMouth
- cursor(4)
- set gDB to new(xtra("v12dbe"), the moviePath & "lang.v12", "readOnly", EMPTY)
- set gDBTable to new(xtra("v12table"), mGetRef(gDB), "language")
- if gLangDirect = 1 then
- set searchField to "myEnglish"
- set takeField to "my" & gLangName
- set sndPth to gLangSelect
- else
- set searchField to "my" & gLangName
- set takeField to "myEnglish"
- set sndPth to "e"
- end if
- mSetCriteria(gDBTable, searchField, "=", whichWord)
- mOrderBy(gDBTable, searchField, "ascending")
- mSelect(gDBTable)
- put mGetField(gDBTable, takeField) into field "wordFound"
- set gFindSnd to mGetField(gDBTable, "myCodeName")
- set cat to chars(gFindSnd, 1, 4)
- set gFindSnd to gSndPath & sndPth & gFileDelimiter & cat & gFileDelimiter & gFindSnd & ".aif"
- set gDBTable to 0
- set gDB to 0
- set the memberNum of sprite gFindMouth to the number of member "findSnd up"
- cursor(-1)
- end
-
- on createDatabase
- global gFileDelimiter, gDB
- cursor(4)
- set whichPath to the moviePath
- set gDB to new(xtra("v12dbe"), whichPath & "lang.v12", "create", EMPTY)
- if V12Status() then
- alert("error code" && V12Error())
- end if
- mEditDBStructure(gDB)
- mReadDBStructure(gDB, "Literal", field "langTemplate")
- if V12Status() then
- alert("error code" && V12Error())
- end if
- mBuild(gDB)
- if V12Status() then
- alert("error code" && V12Error())
- end if
- put mDumpStructure(gDB)
- set gDB to 0
- cursor(-1)
- end
-
- on loadDatabase
- cursor(4)
- set gDB to new(xtra("v12dbe"), the moviePath & "lang.v12", "readWrite", EMPTY)
- set gDBTable to new(xtra("v12table"), mGetRef(gDB), "language")
- set the itemDelimiter to "*"
- repeat with X = 1 to the number of lines in field "e vocab"
- set aLine to line X of field "e vocab"
- set aNum to item 1 of aLine
- set aEngWord to item 2 of aLine
- if item 1 of line X of field "s vocab" = aNum then
- set aFWord to item 3 of line X of field "f vocab"
- set aIWord to item 3 of line X of field "I vocab"
- set aSWord to item 3 of line X of field "s vocab"
- set aGWord to item 3 of line X of field "g vocab"
- mAddRecord(gDBTable)
- mSetField(gDBTable, "myCodeName", aNum)
- mSetField(gDBTable, "myEnglish", aEngWord)
- mSetField(gDBTable, "myFrench", aFWord)
- mSetField(gDBTable, "mySpanish", aSWord)
- mSetField(gDBTable, "myGerman", aGWord)
- mSetField(gDBTable, "myItalian", aIWord)
- mUpdateRecord(gDBTable)
- else
- alert("Something's Wrong with the numbers!")
- end if
- if V12Status() then
- alert("error code" && V12Error())
- end if
- end repeat
- if V12Status() then
- alert("error code" && V12Error())
- end if
- set gDBTable to 0
- set gDB to 0
- set the itemDelimiter to ","
- cursor(-1)
- end
-